package com.kly.module_base.dialog.help

import androidx.fragment.app.FragmentManager
import android.util.SparseArray
import android.view.Gravity
import android.view.View

class Contorller {

    private var fullScreen: Boolean = false
    private var mViews: SparseArray<Int>? = null
    private var k_fragmentManager: FragmentManager? = null
    private var k_dialogOutTransparency: Float = 0.7f
    private var k_dialogGravity: Int = Gravity.NO_GRAVITY
    private var k_dialogAnimation: Int = 0
    private var k_cancelable: Boolean = false
    private var k_listener: View.OnClickListener? = null
    private var k_layoutId: Int = 0
    private var k_contentView: View? = null
    private var k_dismisslistener: DismissListener? = null
    private var k_LogicListener: LogicListener? = null


    fun getLogiclistener(): LogicListener? {
        return k_LogicListener
    }

    fun getFullScreen(): Boolean {
        return fullScreen
    }

    fun getLayoutId(): Int {
        return k_layoutId
    }

    fun getContentView(): View? {
        return k_contentView
    }

    fun getGravity(): Int {
        return k_dialogGravity
    }

    fun getFragmentManager(): FragmentManager? {
        return k_fragmentManager
    }

    fun getAnimation(): Int {
        return k_dialogAnimation
    }

    fun getDialogCancel(): Boolean {
        return k_cancelable
    }

    fun getDialogOutTransparency(): Float {
        return k_dialogOutTransparency
    }


    fun getViews(): SparseArray<Int>? {
        return mViews
    }

    fun getClickListener(): View.OnClickListener? {
        return k_listener
    }

    fun dismissCallback(): DismissListener? {
        return k_dismisslistener
    }

    /**
     * 参数接守
     * */
    class Params {
        var fullScreen: Boolean = false
        var mViews = SparseArray<Int>()
        var k_fragmentManager: FragmentManager? = null
        var k_dialogOutTransparency: Float = 0.7f
        var k_dialogGravity: Int = Gravity.NO_GRAVITY
        var k_dialogAnimation: Int = 0
        var k_cancelable: Boolean = false
        var k_listener: View.OnClickListener? = null
        var k_layoutId: Int = 0
        var k_contentView: View? = null
        var k_dismisslistener: DismissListener? = null
        var k_LogicListener: LogicListener? = null

        /**
         * 参数组装
         * */
        fun apply(c: Contorller?) {
            c?.mViews = mViews
            c?.k_fragmentManager = k_fragmentManager
            c?.k_dialogOutTransparency = k_dialogOutTransparency
            c?.k_dialogGravity = k_dialogGravity
            c?.k_dialogAnimation = k_dialogAnimation
            c?.k_cancelable = k_cancelable
            c?.k_listener = k_listener
            c?.k_layoutId = k_layoutId
            c?.k_contentView = k_contentView
            c?.k_dismisslistener = k_dismisslistener
            c?.k_LogicListener = k_LogicListener
            c?.fullScreen = fullScreen
        }
    }
}


